Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JAR files are not refreshed after they are updated #1002

Merged
merged 1 commit into from
May 1, 2019

Conversation

snjeza
Copy link
Contributor

@snjeza snjeza commented Apr 18, 2019

Fixes redhat-developer/vscode-java#775

Signed-off-by: Snjezana Peco [email protected]

@snjeza snjeza requested review from gorkem and fbricon April 18, 2019 19:10
}
refresh(resource, changeType, monitor);
IProject project = resource.getProject();
IJavaProject javaProject = JavaCore.create(project);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you need to check it's a Java project beforehand

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated the PR.

if (r != null && r.equals(resource)) {
IClasspathEntry[] rawClasspath = javaProject.getRawClasspath();
javaProject.setRawClasspath(new IClasspathEntry[0], monitor);
javaProject.setRawClasspath(rawClasspath, monitor);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the target classpathEntry is found, add break to exit ealier.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated.

if (entry.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
IPath path = entry.getPath();
IFile resource = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
if (resource != null && resource.exists() && !resource.isDerived()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the jar defined in .classpath was physically missing, then added later, it would not be watched/detected when added

if (resource != null && resource.exists() && !resource.isDerived()) {
IPath location = resource.getLocation();
if (location != null && !isContainedIn(location, sources)) {
sources.add(location);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

problem is you're later appending /** to the jar extension, which seems to cause some issues on my mac

@snjeza
Copy link
Contributor Author

snjeza commented Apr 30, 2019

@fbricon I have updated the PR.

@fbricon fbricon merged commit fafbf93 into eclipse-jdtls:master May 1, 2019
@fbricon
Copy link
Contributor

fbricon commented May 1, 2019

I don't quite like the hack of calling javaProject.setRawClasspath twice, but it does the job for now. So I'll keep it that way for this release, but hopefully there's a better way to update the classpath and trigger a build

@fbricon fbricon added this to the End April 2019 milestone May 1, 2019
@fbricon fbricon added the bug label May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JAR files are not refreshed after they are updated.
3 participants